<template>
  <div v-show="pushBackExist">
      <span style="font-size: 16px;font-weight: bolder;">退回信息：</span>
      <span v-for="pbItem in pushBackList">{{pbItem.text}} （{{pbItem.creat_time}}）</span>
  </div>
</template>

<script>
export default {
  data() {
    return {
      pushBackExist:false,
      pushBackList:[],

      pData:{'nodeins_id':null},
    }
  },
  props: {
    nodeins_id: { type: String, default: null },
  },
  watch: {
    nodeins_id: {
      async handler(newval, oldval) {
        if (newval != null && newval!='') {
          if (newval != oldval) {
            this.load();
          }
        }
      },
      immediate: true
    }
  },
  created() {},
  mounted() {
    this.load();
  },
  methods: {
    async load() {
      if(this.pData.nodeins_id==this.nodeins_id){return;}

      this.pushBackExist = false;
      this.pushBackList = [];

      if(this.em(this.nodeins_id)){return;}

      this.pData.nodeins_id=this.nodeins_id;
      let CheckPushBackInfo = await elm.post('/system/login/flow/SearchRunningPbtoNodeins', this.pData);
      if(CheckPushBackInfo.length>0){
        for(let i=0;i<CheckPushBackInfo.length;i++){
          let item = CheckPushBackInfo[i];
          if(!this.em(item.sys_createtime)){
            item['creat_time'] = item.sys_createtime.split('T')[0];
          }
        }

        this.pushBackExist = true;
        this.pushBackList = CheckPushBackInfo;
      }
    },

    em: function (s) {
      if (s == null || s == '') { return true; }
      else { return false; }
    },
  }
}
</script>